package polimi.sc.expoquest.screen;

import polimi.sc.expoquest.QuestApplication;
import polimi.sc.expoquest.R;
import polimi.sc.expoquest.screen.gossip.GossipMainActivity;
import polimi.sc.expoquest.screen.point.PointActivity;
import polimi.sc.expoquest.screen.singleplay.SingleplayMainActivity;
import android.os.Bundle;
import android.app.Activity;
import android.app.AlertDialog;
import android.content.DialogInterface;
import android.content.Intent;
import android.view.Menu;
import android.view.View;
import android.widget.Toast;

public class DashboardActivity extends Activity {

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_dashboard);
//		QuestApplication questApp = (QuestApplication)getApplicationContext();
//		int id = questApp.getUserID();
//		Toast toast = Toast.makeText(this, String.valueOf(id) , Toast.LENGTH_LONG);
//		toast.show();
		
	}

	@Override
	public boolean onCreateOptionsMenu(Menu menu) {
		// Inflate the menu; this adds items to the action bar if it is present.
		getMenuInflater().inflate(R.menu.activity_dashboard, menu);
		return true;
	}

	public void CoinButtonOnClick(View v){
		Intent dashbordIntent = new Intent(this, PointActivity.class);
        startActivity(dashbordIntent);
	}
	public void GossipButtonOnClick(View v){
		Intent dashbordIntent = new Intent(this, GossipMainActivity.class);
        startActivity(dashbordIntent);
	}
	public void DiceButtonOnClick(View v){
		Intent dashbordIntent = new Intent(this, SingleplayMainActivity.class);
        startActivity(dashbordIntent);
	}
	public void sign_out_btn_click(View v) //sign out function 
	{
		final Intent LoginIntent = new Intent(this, LoginActivity.class);
		AlertDialog.Builder builder = new AlertDialog.Builder(this);
		builder
    	.setTitle("sign out")
    	.setMessage("Are you sure you want to sign out?")
		.setIcon(android.R.drawable.alert_dark_frame)
		.setPositiveButton("Yes", new DialogInterface.OnClickListener()
		{
			public void onClick(DialogInterface dialog, int which )
			{									
				startActivity(LoginIntent);
			}					
		})
		.setNegativeButton("No", null)
		.show();
	}
	
}
